/*
build_objects.dm
All of the objects contained by the building system.
The first ones presented are the ones that have special effects, and after that, everything else
*/
obj/builditems
	icon='BuildTwo.dmi'

	door
		icon_state="gray_closed"
		aname="Door"
		density=1
		opacity=1

		DblClick()
			var/mob/player/m = usr
			if(m.ckey == builtowner)
				var/s = input(m,"What is the new password?",,password) as text
				password = s
				Query("UPDATE `[sql_objecttable]` SET password='[password]' WHERE uid='[uid]';")

		Bumped(mob/player/m)
			if(password && m.ckey!=builtowner)
				var/s = input("What be the password, matey?") as text
				if(s == password)
					open()
				else
					m << "Invalid password!"
			else
				open()
		proc
			open()
				flick("gray_opening", src)
				density = 0
				opacity = 0
				sleep(5)
				icon_state="gray_open"
				spawn(50)
					close()
			close()
				flick("gray_closing", src)
				density = 1
				opacity = 1
				sleep(5)
				icon_state="gray_closed"

	portal
		aname="Portal"
		icon_state="portal"
		layer=TURF_LAYER+1
		density=1
		New()
			..()
			if(suffix)
				for(var/obj/builditems/portal/p in world)
					if(p.tag == suffix)
						Tele_X = p.x
						Tele_Y = p.y
						Tele_Z = p.z

						p.Tele_X = x
						p.Tele_Y = y
						p.Tele_Z = z
		Bumped(atom/movable/o)
			if(isplayer(o))
			/*(	if(suffix)
					for(var/obj/builditems/portal/p in world)
						if(p.tag == suffix)
							o.density = 0
							o.loc = locate(p.loc)
							o.density = 1*/
				if((Tele_X && Tele_Y && Tele_Z))
					o.density = 0
					o.loc = locate(Tele_X,Tele_Y,Tele_Z)
					o.density = 1
				else
					o << "Sorry, this portal currently isn't working."
			else return ..()
	sign
		aname = "Sign"
		density = 1
		layer = MOB_LAYER+1
		icon_state = "sign"
		LeftClick(mob/caller)
			if(placeable) ..()
			else
				if(caller.ckey == builtowner)
					if(alert(caller, "Would you like to change your sign's message?","Sign","Yes","No") == "Yes")
						var/msg=input(usr,"What shall it say?","New Sign Message",mesage) as null|message
						usr << "<font color=teal>You changed your sign's message from \"[mesage]\" to \"[msg]\""
						mesage=msg

						Query("UPDATE `[sql_objecttable]` SET mesage='[mesage]' WHERE uid=[uid];")
						return
				else if(mesage)caller << "The sign reads: [mesage]"

	custom
		LeftClick(mob/player/caller)
			..()
			if(placeable)
				caller.cur_state=icon_state
				caller.cur_name =name
				caller.cur_file =iconFile

	redcarpet		{aname="Red Carpet";icon_state="redcarpet"}
	bluecarpet		{aname="Blue Carpet";icon_state="bluecarpet"}
	greencarpet		{aname="Green Carpet";icon_state="greentile"}
	kiwicarpet		{aname="KiwiGreen Carpet";icon_state="kiwitile"}
	bluedcarpet		{aname="BlueDiamond Carpet";icon_state="bluetile"}
	purplecarpet	{aname="Purple Carpet";icon_state="purpletile"}
	graycarpet1		{aname="LightGrayBox Carpet";icon_state="graytile1"}
	graycarpet2		{aname="GrayBox Carpet";icon_state="graytile2"}
	graycarpet3		{aname="GrayCircle Carpet";icon_state="graytile3"}
	whitecarpet		{aname="White Carpet";icon_state="whitetile"}
	redfuzzycarpet	{aname="Red Fuzzy Carpet";icon_state="redfuzzycarpet"}
	brightrug		{aname="Bright Rug";icon_state="brightrug"}
	metalfloor		{aname="Metal Floor";icon_state="metal"}
	stonefloor		{aname="Stone Floor";icon_state="stone"}
	woodfloor		{aname="Wooden Floor";icon_state="wood"}
	kitchenfloor	{aname="Kitchen Floor";icon_state="kitchentile"}
	nailedfloor		{aname="Nailed Wooden Floor";icon_state="nailedwood"}
	sidewalk		{aname="Sidewalk";icon_state="sidewalk"}
	redbrickwall	{aname="RedBrickWall";icon_state="redbrickwall";density=1}
	bluebrickwall	{aname="BlueBrickWall";icon_state="bluebrickwall";density=1}
	redxwall		{aname="Red X Wall";icon_state="bloodwall";density=1}
	silverwall		{aname="SilverWall";icon_state="silverwall";density=1}
	graywall		{aname="GrayWall";icon_state="graywall";density=1}
	bluewall		{aname="BlueWall";icon_state="bluewall";density=1}
	orangewall		{aname="OrangeWall";icon_state="orangewall";density=1}
	redwall			{aname="RedWall";icon_state="redwall";density=1}
	greenwall		{aname="GreenWall";icon_state="greenwall";density=1}
	yellowwall		{aname="YellowWall";icon_state="yellowwall";density=1}
	bluewall		{aname="BlueWall";icon_state="bluewall";density=1}
	crystalwall		{aname="CrystalWall";icon_state="crystalwall";density=1}
	tablebottomleft	{aname="Table - BtmLeft";icon_state="tablebtmleft";density=1}
	tablebottomright{aname="Table - BtmRight";icon_state="tablebtmright";density=1}
	tabletopleft	{aname="Table - TopLeft";icon_state="tabletopleft";density=1}
	tabletopright	{aname="Table - TopRight";icon_state="tabletopright";density=1}
	tablemidvert	{aname="Table - MidVertical";icon_state="tablemidv";density=1}
	tablemidhoriz	{aname="Table - MidHoriz";icon_state="tablemidh";density=1}
	tableleft		{aname="Table - Left";icon_state="tableleft";density=1}
	tableright		{aname="Table - Right";icon_state="tableright";density=1}
	tabletop		{aname="Table - Top";icon_state="tabletop";density=1}
	tablebottom		{aname="Table - Bottom";icon_state="tablebtm";density=1}
	porctableleft	{aname="PorcelainTable - Left";icon_state="mtableleft";density=1}
	porctablemid	{aname="PorcelainTable - Middle";icon_state="mtablemid";density=1}
	porctableright	{aname="PorcelainTable - Right";icon_state="mtableright";density=1}
	metaltableleft	{aname="MetalTable - Left";icon_state="metablel";density=1}
	metaltablemiddle{aname="MetalTable - Middle";icon_state="metablem";density=1}
	metaltableright	{aname="MetalTable - Right";icon_state="metabler";density=1}
	glass1			{aname="Transparent Glass";icon_state="glass1";density=1}
	glass2			{aname="Translucent Glass";icon_state="glass2";density=1}
	glass3			{aname="Stained Glass";icon_state="glass3";density=1}
	ice				{aname="Ice";icon_state="ice"}
	water			{aname="Water";icon_state="water"}
	box				{aname="Wooden Box";icon_state="box";density=1}
	whitefence		{aname="White Fence";icon_state="whitefence";density=1}
	bush1			{aname="Bush";icon_state="bush1";density=1}
	bush2			{aname="Bush";icon_state="bush2";density=1}
	bush3			{aname="Bush";icon_state="bush3";density=1}
	marblesink		{aname="Marble Sink";icon_state="sink2"}
	refridgerator	{aname="Refridgerator";icon_state="fridge"}
	blender			{aname="Blender";icon_state="blender"}
	microwave		{aname="Microwave";icon_state="microwave"}
	bed				{aname="Bed";icon='1x2.dmi';icon_state="bed";density=1}
	bedsheet		{aname="Bed - Sheet";icon_state="bedsheet"}
	treetop			{aname="Tree";icon='1x2.dmi';icon_state="tree"}


	//level1
	//level2
	//buyable
